<template>
  <div class="rectify-list">
    <div class="subtitle">位置选择历史</div>
    <div class="list">
      <div class="item ellipsis" v-for="(item, index) in list" :key="index" :title="item.shortName" :class="{ active: item.tmpId === selected.tmpId }" @click="onItem(item)">
        {{ item.shortName }}
      </div>
    </div>
  </div>
</template>
<script>
// 选择位置历史
export default {
  name: 'TaskRectifyList',
  props: { list: { type: Array, default: () => [] } },
  data() {
    return { selected: {} }
  },
  methods: {
    onItem(item) {
      this.selected = item
      this.$emit('ok', { position: item })
    }
  }
}
</script>
<style lang="scss" scoped>
.rectify-list {
  height: 100%;
}
.subtitle {
  font-size: 14px;
  line-height: 20px;
  color: #909399;
  margin-bottom: 10px;
}
.list {
  height: calc(100% - 30px);
  overflow-y: auto;
  background: #eef1f6;
  border-radius: 6px;
}
.item {
  font-size: 12px;
  padding: 5px 15px;
  cursor: pointer;
  &:hover {
    background: #e0eefd;
  }
  &.active {
    background: #74a8f8;
    color: white;
  }
}
</style>
